﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaInfrastructure;

using DotSpatial.Topology;

using System.Drawing;


namespace FXnaGis
{
    [Serializable]
    /// <summary>
    /// 用于绘制这个特定的网格
    /// </summary>
    public class FModflowGridShape:FShape
    {

        public FModflowGridShape(string id)
            : base(id)
        {
 
        }


        FModflowGrid _grid;

        public FModflowGrid Grid
        {
            get { return _grid; }
            set { _grid = value; }
        }




        

        public override void DrawLable(FMapArgs args)
        {
            base.DrawLable(args);
        }
   



        protected  void DrawTopView(FMapArgs args)
        {
           



            //先尝试着画行

            for (int i = 0; i < this._grid.NX; i++)
            {

                Coordinate p1 = new Coordinate(this._grid.GetXPos(i), this._grid.YMin);

                Coordinate p2 = new Coordinate(this._grid.GetXPos(i), this._grid.YMax);

                args.Device.DrawLine(Pens.Black, args.ProjToPixel(p1), args.ProjToPixel(p2));


            }



            //然后划列

            for (int j = 0; j < this._grid.NY; j++)
            {


                Coordinate p1 = new Coordinate(this._grid.XMin, this._grid.GetYPos(j));

                Coordinate p2 = new Coordinate(this._grid.XMax, this._grid.GetYPos(j));


                args.Device.DrawLine(Pens.Black, args.ProjToPixel(p1), args.ProjToPixel(p2));



            }



           


        }


          public override bool Intersects(Envelope envelope)
       {
           return true;

       }

        
        

    }
}
